<template>
	<view class="article-box">
		<mp-html :content="srcHtml" :lazy-load="true">
			<u-loadmore v-if="!contentIsLoading" :status="'loading'" />
		</mp-html>
	</view>
</template>

<script>
	import mpHtml from '@/plugins/mp-html/mp-html'
	export default {
		components:{
			mpHtml
		},
		data() {
			return {
				srcHtml: '',
				contentIsLoading: false
			}
		},
		onShow() {
			
		},
		onLoad() {
			if(this.$Route.query){
				if (this.$Route.query.type){
					this.getArticleData(this.$Route.query)
				}
			}
		},
		methods:{
			getArticleData(query = {}){
				const that = this
				this.$api.article.content(query).then(res => {
					// console.log(res)
					this.srcHtml = res.content
					uni.setNavigationBarTitle({
						title: res.title
					})
					this.contentIsLoading = true
				}).catch(err => {
					uni.showModal({
						showCancel:false,
						content: err.message,
						success(e) {
							that.$myRouter.back()
						}
					})
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.article-box{
		padding: 30upx;
	}
</style>
